<?php

namespace App\Http\Requests\Admin\Customer\Product;

use App\Http\Requests\ApiRequest;
use Illuminate\Foundation\Http\FormRequest;
use Illuminate\Validation\Rule;

/**
 * @property string type
 * @property int value
 * @property int id
 */
class ProductStatusRequest extends ApiRequest
{
    /**
     * Determine if the user is authorized to make this request.
     *
     * @return bool
     */
    public function authorize()
    {
        return true;
    }

    /**
     * Get the validation rules that apply to the request.
     *
     * @return array
     */
    public function rules()
    {
        return [
            'id'    => ['required', 'int', 'min:1'],
            'type'  => ['required', 'string', Rule::in(['is_sale', 'is_deleted', 'is_hot', 'is_new'])],
            'value' => ['required', 'int', Rule::in([0, 1])],
        ];
    }

    /**
     * @return array
     */
//    public function messages()
//    {
//        return [
//            'id.*'    => '无效的商品ID',
//            'type.*'  => '商品状态的字段必须是指定的',
//            'value.*' => '商品状态的字段值必须是0或1',
//        ];
//    }
}
